<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>商品搜索</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/datepicker3.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<link href="css/ddj.css" rel="stylesheet"><!-- 深度定制样式： -->

</head>

<body>
<!-- 头部 -->
	<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>	
				</button>
				<a class="navbar-brand" href="#">
					<span>旧货追踪管理系统</span>
					Admin
				</a>
				<ul class="user-menu">
					<li class="dropdown pull-right">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span> User <span class="caret"></span></a>
						<ul class="dropdown-menu" role="menu">
							<li><a href="#"><span class="glyphicon glyphicon-user"></span> Profile</a></li>
							<li><a href="#"><span class="glyphicon glyphicon-cog"></span> Settings</a></li>
							<li><a href="#"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
						</ul>
					</li>
				</ul>
			</div>
		</div><!-- /.container-fluid -->
	</nav>
<!-- 侧边菜单 -->		
	<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
		<form role="search" action="<c:url value='/product/search'/>">
			<div class="form-group">
				<input type="text" class="form-control" placeholder="Search" name="name">
			</div>
			<div class="form-group">
				<input type="submit" class="form-control btn-primary" value="搜索">
			</div>
		</form>
		<ul class="nav menu">
			<li class="active"><a href="index.html"><span class="glyphicon glyphicon-dashboard"></span>首页</a></li>
			<li role="presentation" class="divider"></li>
			<c:choose>
				<c:when test="${empty sessionScope.user }">
					  <li><a href="login.html"><span class="glyphicon glyphicon-user"></span>登录</a></li> 
					  <li><a href="regist.html"><span class="glyphicon glyphicon-user"></span>注册</a></li> 
				</c:when>
				<c:otherwise>
					 <li><span class="glyphicon glyphicon-user"></span>  用户名：${sessionScope.user.userName }</li><br/>
					  <li><a href="quit.html"><span class="glyphicon glyphicon-user"></span>退出</a></li> 
				</c:otherwise>
			</c:choose>
		</ul>
		<div class="attribution">Make by ddj <a href="http://www.cssmoban.com/" target="_blank" title="模板之家">来源</a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网址之家</a></div>
	</div><!--/.sidebar-->
<!-- 右边主区 -->		
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">			
		<div class="row">
			<ol class="breadcrumb">
				<li><a href="#"><span class="glyphicon glyphicon-home"></span></a></li>
				<li class="active">首页</li>
			</ol>
		</div><!--/.row-->
			
		<ul class="product-inline">
		
		<c:choose>
		
		  <c:when test="${plist!=null }">
		     <c:forEach items="${plist }" var="list" varStatus="st"> 
			<li class="product-panel">
			    <a href="#">
					<div class="login-panel panel panel-default ">
						<div class="panel-heading">
						<c:out value="${list.pname }" />
						
						
						
						<div class="product-btn">
						    <!-- <a href="index.html?pid=中文" class="btn btn-primary">详情</a> -->
						    
					        <a href="buy.html?pid=${list.pid }&price=${list.price}" class="btn btn-primary">购买</a>
					    
					    </div>
					  
					  
						</div>
						<div class="panel-body img-product">
							<img src="${list.pictureSrc }">
						</div>
						<div class="panel-heading">
						 <span>价格：</span> <span class="red">${list.price }</span>
						  </div>
						<div class="panel-heading">
						 <span>交易次数：</span> <span class="red">${list.tradeTimes }</span>
						  </div>
						<div class="panel-heading">
						 <span>上次交易时间：</span> <span class="red"><fmt:formatDate value="${list.lastTradeTime}" /></span>
						  </div>
					</div>
                </a>
            </li>
           	
          </c:forEach> 	
		  </c:when>
		  <c:otherwise>
		      没有该商品
		  </c:otherwise>
		</c:choose>
		
		<%-- <c:if test="${plist!=null }">
			<c:forEach items="${plist }" var="list" varStatus="st"> 
			<li class="product-panel">
			    <a href="#">
					<div class="login-panel panel panel-default ">
						<div class="panel-heading">
						<c:out value="${list.pname }" />
						
						
						
						<div class="product-btn">
						    <a href="index.html?pid=中文" class="btn btn-primary">详情</a>
						    
					        <a href="buy.html?pid=${list.pid }&price=${list.price}" class="btn btn-primary">购买</a>
					    
					    </div>
					  
					  
						</div>
						<div class="panel-body img-product">
							<img src="${list.pictureSrc }">
						</div>
						<div class="panel-heading">
						 <span>价格：</span> <span class="red">${list.price }</span>
						  </div>
					</div>
                </a>
            </li>
           	
          </c:forEach> 	
         </c:if> --%>	
		</ul>
		
<!-- 商品细节区 -->		
		
	</div>	<!--/.main-->
	
<!-- 脚本加载 -->
	<script src="js/jquery-1.11.1.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/chart.min.js"></script>
	<script src="js/chart-data.js"></script>
	<script src="js/easypiechart.js"></script>
	<script src="js/easypiechart-data.js"></script>
	<script src="js/bootstrap-datepicker.js"></script>
	<script>
	
		!function ($) {
		    $(document).on("click","ul.nav li.parent > a > span.icon", function(){          
		        $(this).find('em:first').toggleClass("glyphicon-minus");      
		    }); 
		    $(".sidebar span.icon").find('em:first').addClass("glyphicon-plus");
		}(window.jQuery);

		$(window).on('resize', function () {
		  if ($(window).width() > 768) $('#sidebar-collapse').collapse('show')
		})
		$(window).on('resize', function () {
		  if ($(window).width() <= 767) $('#sidebar-collapse').collapse('hide')
		})

	</script>	
</body>

</html>

